package com.lizhi.updata;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.lizhi.util.Util;


public class Main {
	public static final String BOOK_HOST="https://freebook.firebaseio.com/books.json";


	public static void main(String[] args) {

		// try {
		// String url = "https://freebook.firebaseio.com/books.json?orderBy=%22time%22&startAt=%220%22&limitToFirst=2&print=pretty";
		//
		// CloseableHttpClient httpClient = HttpClients.createDefault();
		// HttpGet httpPost = new HttpGet(url);
		// CloseableHttpResponse response = httpClient.execute(httpPost);
		// InputStream inputStream = response.getEntity().getContent();
		// String str=Util.readStream(inputStream);
		// JSONObject jsonObject = JSON.parseObject(str);
		//
		// Set<String> keySet = jsonObject.keySet();
		// for (String string : keySet) {
		// BookModel bookModel=JSON.toJavaObject(jsonObject.getJSONObject(string),BookModel.class);
		// System.out.println(bookModel.name);
		// }
		//
		// } catch (IllegalStateException | IOException e) {
		// e.printStackTrace();
		// }
		
//		String url=formateUrl(BOOK_HOST, "0", String.valueOf(System.currentTimeMillis()));
		
		
		
		
		
//		Util.clearData("https://freebook.firebaseio.com/books/-JxgD3Oaw3MwhQ0sGb6e.json");

	}
	public static String formateUrl(String host, String startTime, String endTime) {
		StringBuffer buffer = new StringBuffer(host);
		buffer.append("?orderBy=%22time%22&startAt=%22"+startTime+"%22&endAt=%22"+endTime+"%22&limitToLast=5&print=pretty");
		return buffer.toString();
	}


}
